﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace no._2
{
    class Program
    {
        public  static int muxnum(int []a,int n)
        {
            int mux1 = a[0];
            for(int i = 1; i < n; i++)
            {
                if (a[i] > mux1)
                {
                    mux1 = a[i];
                }
            }
            return mux1;
        }
        public static int minnum(int[] a, int n)
        {
            int min1 = a[0];
            for (int i = 1; i < n; i++)
            {
                if (a[i] < min1)
                {
                    min1 = a[i];
                }
            }
            return min1;
        }
        public  static int sumnum(int[]a,int n)
        {
            int sum = 0;
            for(int i = 0; i < n; i++)
            {
                sum = sum + a[i];
            }
            return sum;
        }
        static void Main(string[] args)
        {
            Console.WriteLine("请输入数组元素个数：");
            int n;
            n = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("请输入数组元素：");
            int[] aray = new int[n];
            for(int i = 0; i < n; i++)
            {
                aray[i]= Convert.ToInt32(Console.ReadLine());
            }
            int mux = muxnum(aray, n);
            Console.WriteLine("数组元素中最大值为"+mux);
            int min = minnum(aray, n);
            Console.WriteLine("数组元素中最小值为" + min);
            int sum = sumnum(aray, n);
            int avery = sum / n;
            Console.WriteLine("数组的平均值为" + avery);
            Console.WriteLine("数组的和为" + sum);
            Console.ReadKey();
        }
    }
}
